<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<script type="text/javascript" src="${res}/js/prp_attach.js"></script>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<x:forEach select="$xmlData/data/content/content" var="content">
    <c:set var="fileCodeAll">${fileCodeAll};<x:out select="$content/file_code" /></c:set>
    <c:set var="fileNameAll">${fileNameAll}|<x:out select="$content/name" /></c:set>
</x:forEach>
<input id='auditflag' type='hidden' value='${param.auditflag}'>
<div class="t_bar">附件清单<span style="float:right; font-size: 12px; font-weight:none;"><a href="#"  class="yase" onclick="downloadAllFile();">一键下载所有附件</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"  class="yase" onclick="reviewAllFile();">在线浏览所有需资格审查的附件</a></span></div>
<iframe id="ifile" style="display:none"></iframe>
<table id="prpContent_upload" label="附件" border="0" cellspacing="0"
       width="100%" cellpadding="0" class="table01 t_css"
       style="*border-bottom: #a1c0dc 1px solid;">
    <thead>
    <tr>
        <th width="8%">序号</th>
        <th width="30%">材料名称</th>
        <th width="7%">是否必备材料</th>
        <th width="25%">备注</th>
    </tr>
    </thead>
    <tbody>
    <c:set value="0" var="index" scope="page" />
    <x:forEach select="$xmlData/data/content/content" var="content">
        <tr>
            <c:set var="seq_no"><x:out select="$content/@seq_no" /></c:set>
            <td align="center">&nbsp;${index+1}<span id="attach_seq${seq_no}" style="display:none">${seq_no}</span></td>
            <td ><x:out select="$content/name" /></td>
            <td align="center"><x:out select="$content/berif" /></td>

            <td align="center">
                <span id="file_code${seq_no}" style="display:none"><x:out select="$content/file_code" /></span>
                <c:set var="file_code"><x:out select="$content/file_code" /></c:set>
                <c:if test="${file_code!=''}">
                    <a id="content_downLoadFile0" href="${ctx}/file/ajax-filedownload?fileCode=${file_code}" class="link_x"><x:out select="$content/file_name" /></a>
                    &nbsp;&nbsp;<br/>(上传时间<x:out select="$content/file_date" />)</c:if>&nbsp;
            </td>

        </tr>
        <c:set value="${index+1}" var="index" scope="page" />
    </x:forEach>
    </tbody>
</table>
<script type="text/javascript">
    /*
        $(function() {
            if ($('#auditflag').val() == 'edit')
                hiddenAttach('prpContent_upload');
        });
        */
    function reviewAllFile(){
        fileCodesTemp = '${fileCodeAll}';
        fileNamesTemp = '${fileNameAll}';
        tb_show("在线浏览所有需资格审查的附件","${ctx}/downattach/openprpapprovedialog-attach?TB_iframe=true&height=460&width=824", false);
    }

    function downloadAllFile(){
        fileCodesTemp = '${fileCodeAll}';
        fileCodesTemp = fileCodesTemp.replace(/;/g, "");
        if(fileCodesTemp.length>0){
            scmSuccess("正在下载……请稍侯…",null,4000);
            var url = "${ctx}"+ "/downattach/getintrozip?type=pdf&fileCodeAll=${fileCodeAll}";
            $("#ifile").attr("src",url);
        }else{
            scmWarn("没有需要下载的附件！",null,4000);
        }

        return false;
    }
</script>
